/*package servlet;

import hibernate.AssetInfo;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DAO.ReportManagementDAO;


*//**
 * Servlet implementation class getDiscountServlet
 *//*
public class getDiscountServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    *//**
     * @see HttpServlet#HttpServlet()
     *//*
    public getDiscountServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	*//**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 *//*
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		
	    request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/plain");
		PrintWriter out = response.getWriter();		
        int start = Integer.parseInt(request.getParameter("start"));
        int limit = Integer.parseInt(request.getParameter("limit"));
        
        String state = request.getParameter("state");
        String type = request.getParameter("type");
        String department = request.getParameter("department");
        String name = request.getParameter("name");
        ReportManagementDAO getDiscountDAO = new ReportManagementDAO();
        
        @SuppressWarnings("unused")
		List getDiscountSelectList = null;     
        
        if(state.equals("") && type.equals("") && department.equals("") && name.equals(""))
        {
        	getDiscountSelectList = getDiscountDAO.getAllDiscount(start , limit);       	         	 
        }           
        else
        {
        	getDiscountSelectList = getDiscountDAO.getDiscountByQuery(start, limit, name, type, state, department);      	
        }
        String s = "{total:'" + getDiscountDAO.count +"',result:[";
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String produceDate,startUseTime;
        for(int i=0; i<getDiscountSelectList.size(); i++){
        	AssetInfo assetInfo = (AssetInfo)getDiscountSelectList.get(i);
        	//本次折旧值=原值（1-残值率）/已使用年限
        	float depreciationValue = (((float)assetInfo.getMoney())*((float)(1-0.05)))/((float)assetInfo.getUsedYears());
        	//折旧值=原值（1-残值率）/使用年限
        	float value = (((float)assetInfo.getMoney())*((float)(1-0.05)))/((float)assetInfo.getLifeYears());
        	//残值 = 原值 - 折扣
        	float residual = (float)assetInfo.getMoney() - value;

        	int depreciationTime = ((assetInfo.getLifeYears())-(assetInfo.getUsedYears()));
            s = s + "{assetNo:'" + assetInfo.getAssetNo() + "',";
            s = s + "model:'" + assetInfo.getModel() + "',";
            s = s + "equipNumber:'" + assetInfo.getEquipNumber() + "',";
            s = s + "name:'" + assetInfo.getName() + "',";
            s = s + "belongTo:'" + assetInfo.getBelongTo() + "',";
            s = s + "type:'" + assetInfo.getType() + "',";
            s = s + "measure:'" + assetInfo.getMeasure() + "',";
            produceDate = dateFormat.format(assetInfo.getProduceDate());
            s = s + "produceDate:'" + produceDate + "',";
            s = s + "supplyUnit:'" + assetInfo.getSupplyUnit() + "',";
            s = s + "money:'" + assetInfo.getMoney() + "',";
            s = s + "state:'"+ assetInfo.getState() + "',";
            s = s + "department:'" + assetInfo.getDepartment() + "',";
            s = s + "principal:'" + assetInfo.getPrincipal() + "',";
            s = s + "buildCharge:'" + assetInfo.getBuildCharge() + "',";
            s = s + "produceUnit:'" + assetInfo.getProduceUnit() + "',";
            startUseTime = dateFormat.format(assetInfo.getStartUseTime());
            s = s + "startUseTime:'"+ startUseTime + "',";
            s = s + "depreciation:'" + assetInfo.getDepreciation()*100 + "%',";
            s = s + "usedYears:'" + assetInfo.getUsedYears() + "',";
            s = s + "appertainEquipment:'"+ assetInfo.getAppertainEquipment() + "',";
            s = s + "lifeYears:'" + assetInfo.getLifeYears() + "',";
            s = s + "remark:'"+ assetInfo.getRemark() + "',";
            s = s + "depreciationValue:'"+ depreciationValue + "',";
            s = s + "residual:'"+ residual + "',";
            s = s + "depreciationTime:'"+ depreciationTime + "'},";
            
        }
		String ss = "{totalCount:'" + getDiscountDAO.count + "'," + "result:[";
        if(!ss.equals(s))
        {
        	s = s.substring(0, s.length()-1);
        }
        s = s + "]}";
        out.print(s);	
		out.flush();		
	}

	*//**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 *//*
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request,response);
	}

}
*/